package com.thoughtworks.bytecode2class.constantpool;

import com.thoughtworks.bytecode2class.ClassReader;


public class StringConstant extends Constant {

    private int stringIndex;

    public StringConstant(ClassReader classReader) {
        super(classReader);
        stringIndex = classReader.forwardChar();
    }

    public void description() {
        System.out.printf("[%d]StringConstant - %s%n", getCount(), getValue());
    }

    public String getValue() {
        Utf8Constant constant = (Utf8Constant) classReader.getConstantPool().get(stringIndex);
        return constant.getValue();
    }
}
